<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>

    <meta charset="UTF-8">
    <title>首页广告管理</title>
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}">
<body>
<div th:insert="~{public/publicTop::admintop}"></div>

<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>首页广告管理</legend>
</fieldset>

<div class="layui-form" style="margin: auto;width: 80%">
    <table class="layui-table">
        <<!--colgroup>
            <col width="150">
            <col width="150">
            <col width="200">
            <col>
        </colgroup>-->
        <thead>
            <tr>
                <th>广告url</th>
                <th>图片</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            <tr th:each="ad:${ads}">
                <form th:action="@{/ad/update}">
                    <td >
                        <input type="hidden" th:value="${ad.getId()}" name="id">
                        <label>
                            <input type="text" th:value="${ad.getUrl()}" name="url" style="width: 100%">
                        </label>
                    </td>
                    <td> <img th:src="@{'/img/'+${ad.getImg()}}"> </td>
                    <td>
                        <input type="submit" class="layui-btn" value="提交">
                        <a class="layui-btn" th:href="@{'/ad/del/'+${ad.getId()}}">删除</a>
                    </td>
                </form>
            </tr>
            <a class="layui-btn" th:href="@{/ad/toadd}">+ 添加广告</a>
        </tbody>
    </table>
</div>
</body>
</html>